<template>
    <div class="top-goods">
        <div v-for="item, index in topGoods" :key="index" class="item">
            <a :href="item.link">
                <img :src="item.image" alt="" @load="imgLoad">
                <div class="title">{{item.title}}</div>
            </a>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        topGoods: {
            type: Array,
            default() {
                return []
            }
        }
    },
    methods: {
        imgLoad() {
            this.$emit('imgLoad')
        }
    }
}
</script>

<style scoped>
    .top-goods{
        display: flex;
        flex-wrap: wrap;
        /* justify-content: start; */
    }

    .top-goods .item{
        text-align: center;
        width: 40%;
    }

    .top-goods .item img{
        width: 80%;
    }

    .top-goods .item .title{
        margin-top: 10px;
    }
</style>